import Vue from 'vue'
import Vuex from 'vuex'
import { getItem, setItem } from '@/utils/storeage'

Vue.use(Vuex)

const tokenKey = 'TOKEN_KEY'
console.log(window.localStorage.getItem(tokenKey))
export default new Vuex.Store({
  state: {
    user: getItem(tokenKey)
  },
  mutations: {
    setUser (state, payload) {
      state.user = payload

      setItem(tokenKey, state.user)
    }
  },
  actions: {
  },
  modules: {
  }
})
